import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/Home.vue'
import NProgress from "../../node_modules/nprogress/nprogress.js"
import "../../node_modules/nprogress/nprogress.css"

Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'Home',
    component: Home,
    meta: {
      pageTitle:"推荐",
      mainPage: true,
      isShowNavigationBar: false
    }
  },
  {
    path: '/shopcar',
    name: 'Shopcar',
    component: () => import('@/views/Shopcar.vue'),
    meta: {
      pageTitle: "购物车",
      mainPage: true,
      isShowNavigationBar: true
    }
  },

  {
    path: '/personalcenter',
    name: 'Personalcenter',
    component: () => import('@/views/Personalcenter.vue'),
    meta: {
      pageTitle: "个人中心",
      mainPage: true,
      isShowNavigationBar: true
    }
  },

  {
    path: '/logistics',
    name: 'Logistics',
    component: () => import('@/views/Logistics.vue'),
    meta: {
      pageTitle: "物流",
      mainPage: false,
      isShowNavigationBar: true


    },

  }

];
NProgress.configure({
  showSpinner: false
});

const router = new VueRouter({
  routes,
})

 
// 守卫导航要放在 router 后面
// 前
router.beforeEach((to, from, next) => {
  NProgress.start();
  next()
})

// 后
router.afterEach((to, from) => {
  NProgress.done();
  // ...
})



export default router
